<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateCommentsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('comments', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('post_id')->unsigned()->nullable()->index('comments_post_id_foreign')->comment('外键');
			$table->integer('parent_id')->unsigned()->nullable()->index('comments_parent_id_foreign')->comment('父评论id');
			$table->string('username')->comment('评论者用户名');
			$table->string('email')->comment('评论者邮箱');
			$table->text('content', 65535)->comment('评论内容');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('comments');
	}

}
